<template>
<pull-to
      :bottom-load-method="infiniteHandler"
      :bottom-config="BOTTOM_DEFAULT_CONFIG" class="main-wrap" style="height: 100vh">
    <ul class="guessList" v-if="searchList.length">
        <li v-for="(item1,index1) in searchList" :key="index1">
            <router-link :to="'/detail?type=1&join_id=0&limit_id=0&group_id=0&goods_id='+item1.goods_id">
            <div class="img">
                <img :src="item1.image" alt="">
            </div>
            <p class="guessListName">
                {{item1.goods_name}}
            </p>
            <p class="guessListPrice">
                <span>￥<span style="font-size: 17px">{{item1.sell_price}}</span></span>
                <span style="color:#F3891B;float:right;vertical-align:middle"><img src="@/assets/img/fire.png" alt="" style="width:12px;vertical-align:middle;margin-right: 3px"><span style="vertical-align:middle">{{item1.popularity}}</span></span>
            </p>
            </router-link>
        </li>
    </ul>
    <div v-else class="foundNot">
        <div v-if="loading">
            <img src="@/assets/img/notFound.png" alt="">
            <p>搜索不到“{{searchContent}}”</p>
        </div>
    </div>
</pull-to>
</template>
<script>
    import PullTo from 'vue-pull-to';
    import request from "@/request/index.js"
    export default {
        name: "searchList",
        components: {
            PullTo
        },
        data() {
            return {
                data:{},
                page:1,
                allPage:1,
                searchContent:'',
                searchList:[],
                loading:false,
                BOTTOM_DEFAULT_CONFIG: {
                    pullText: "上滑继续加载",
                    triggerText: "释放更新",
                    loadingText: "加载中,请稍后",
                    doneText: "内容已全部展示了",
                    failText: "加载失败",
                    loadedStayTime: 1000,
                    stayDistance: 50,
                    triggerDistance: 50,
                },
            }
        },
        watch:{

        },
        methods:{
            infiniteHandler:function(loaded){
                this.page++;
                if(this.page<this.allPage){
                    this.BOTTOM_DEFAULT_CONFIG.doneText = this.BOTTOM_DEFAULT_CONFIG.pullText;
                    loaded("done");
                    request.searchGoods(this);
                }else{
                    this.BOTTOM_DEFAULT_CONFIG.doneText = "内容已全部展示";
                    loaded("done");
                    this.loaded = true;
                }

                // this.guessLick=this.data.guess_like.slice(0,10*this.guessNum);
            },
        },
        mounted() {
            this.searchContent=this.$route.query.keyword;
            request.searchGoods(this);
        },
    }
</script>
<style lang="scss">
.guessListName{
    overflow:hidden;
    text-overflow:ellipsis;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    -moz-box-orient:vertical;
    -moz-line-clamp:2;
    height: 11vw;
    line-height: 5.5vw;
    margin: 12px;
    font-size: 13px;
    color: #333333;
    margin-bottom: 0px;
}
.guessListPrice{
    margin:0 12px;
    line-height: 40px;
    span{
        color:#FF4C50;
        font-size: 12px;
    }
}
.guessList{
    display:flex;
    justify-content: space-between;
    width: 92vw;
    margin: 0 auto;
    flex-wrap: wrap;
    li{
        width:44vw;
        border-radius: 8px;
        overflow: hidden;
        background :#f5f5f5;
        margin-bottom: 15px;

        .img{
            height: 44vw;
            vertical-align: middle;
            line-height: 44vw;
            overflow: hidden;
            background: #ffffff;
        }
        img{
            width: 100%;
            vertical-align: middle;
            height: auto;
        }
    }
}
.foundNot{
    text-align: center;
    padding-top: 90px;
    img{
        width: 120px;
        margin-bottom: 20px;
    }
}
</style>

